package common.platformclient;

import com.alibaba.fastjson.JSONObject;
import feign.Response;
import feign.hystrix.FallbackFactory;
import org.springframework.web.multipart.MultipartFile;

public class PlatformClientFallBack implements FallbackFactory<PlatformClient> {
    @Override
    public PlatformClient create(Throwable throwable) {
        return new PlatformClient() {
            @Override
            public JSONObject test01() {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("code", 11110);
                jsonObject.put("error", throwable.getMessage());
                return jsonObject;
            }

            @Override
            public JSONObject fileUpload(MultipartFile file) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("code", 11110);
                jsonObject.put("error", throwable.getMessage());
                return jsonObject;
            }

            @Override
            public Response fileDownload() {
                return null;
            }
        };
    }
}
